package com.dlc.shop.systemtest.data.amount;

import com.dlc.shop.bean.enums.DeliveryType;
import com.dlc.shop.bean.model.OrderItem;
import com.dlc.shop.delivery.common.param.DeliveryOrderItemParam;
import com.dlc.shop.systemtest.api.amount.DeliverApi;

import java.util.List;
import java.util.Objects;

/**
 * @author lanhai
 * 物流测试数据
 */
public class DeliverData {
    public static DeliveryOrderItemParam getDeliveryOrderItemParam(String orderNumber, Integer deliveryType){
        DeliveryOrderItemParam deliveryOrderItemParam = new DeliveryOrderItemParam();
        deliveryOrderItemParam.setDeliveryType(deliveryType);
        if (Objects.equals(deliveryType, DeliveryType.EXPRESS.getValue())){
            deliveryOrderItemParam.setDvyId(1L);
            deliveryOrderItemParam.setDvyFlowId("2222");
        }
        deliveryOrderItemParam.setOrderNumber(orderNumber);
        deliveryOrderItemParam.setSelectOrderItems(DeliverApi.getOrderItemUnDelivery(orderNumber).getOrderItems());
        return deliveryOrderItemParam;
    }

    public static DeliveryOrderItemParam getDeliveryOrderItemParam(String orderNumber,List<OrderItem> orderItemList){
        DeliveryOrderItemParam deliveryOrderItemParam = new DeliveryOrderItemParam();
        deliveryOrderItemParam.setDeliveryType(3);
        deliveryOrderItemParam.setOrderNumber(orderNumber);
        deliveryOrderItemParam.setSelectOrderItems(orderItemList);
        return deliveryOrderItemParam;
    }
    public static DeliveryOrderItemParam getDeliveryOrderItemParam(String orderNumber){
        DeliveryOrderItemParam deliveryOrderItemParam = new DeliveryOrderItemParam();
        deliveryOrderItemParam.setDeliveryType(1);
        deliveryOrderItemParam.setDvyId(14L);
        deliveryOrderItemParam.setDvyFlowId("sf123123123123");
        deliveryOrderItemParam.setOrderNumber(orderNumber);
        deliveryOrderItemParam.setSelectOrderItems(DeliverApi.getOrderItemUnDelivery(orderNumber).getOrderItems());
        return deliveryOrderItemParam;
    }
}
